<template>
  <div>
    <div class="allSecret">
      <div class="tab">
        <div class="tab_title">
          <li @click="$router.push('/allSecret')">全部秘密</li>
          <li @click="$router.push('/paySecret')">付费秘密</li>
          <li class="active">写秘密</li>
        </div>
        <p @click="$router.push('/')">>>返回首页</p>
      </div>
      <div class="banner">
        <div class="banner-left">
          <div class="writeS">
            <P>有什么秘密想分享大家？</P>
            <textarea placeholder v-model="secret"></textarea>
            <div class="main-foot">
                <div class="main-foot-l">
                <li>
                  <i class="iconfont icon-all-dashang" style="color:#f9bf00"></i>
                  设置金额(1元)
                </li>
                <li>
                  <select>
                    <option value="0">免费秘密</option>
                    <option value="1">付费秘密</option>
                  </select>
                </li>
              </div>
              <div class="main-foot-r" >发布</div>
            </div>
          </div>
        </div>
        <div class="banner-right">
          <div class="tab-card1" style="display: block;">
            <div class="title">
              <span class="news">热门问答</span>
              <span class="more" @click="goQuestion">>>更多问答</span>
            </div>
            <div class="content" v-for="(item,index) in questionList" :key="index">
              <p @click="getQuestion(item)">{{item.title}}</p>
              <div v-html="item.description" @click="getQuestion(item)"></div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      questionList: [],
      secretList: [],
      secretIndex: 10,
      secret: ""
    };
  },
  methods: {
    //获取问答展示列表
    getquestionList() {
      this.$axios
        .get("api/App/User/Question/get_list?limit=2&web=1", {})
        .then(res => {
          this.questionList = res.data.data.list;
          // console.log(this.questionList)
        });
    },
    //查看更多问答
    goQuestion() {
      this.$router.push("/pkQuestion");
    },
    //查看单个问答
    getQuestion(item) {
      this.$router.push({
        path: "/replyQuestion",
        query: { questions_id: item.id }
      });
    }
  },
  mounted() {},
  created() {
    this.getquestionList();
  },

  components: {}
};
</script>
<style lang="scss" scoped>
.allSecret {
  width: 100%;
  height: auto;
  background: #f8f8f8;
  margin-top: -60px;
  .tab {
    width: 100%;
    height: 100px;
    border-bottom: 3px solid #d0d0d0;
    display: flex;
    align-items: flex-end;
    position: relative;
    .tab_title {
      width: 1200px;
      margin: 0 auto;
      display: flex;
      justify-content: flex-start;
      list-style: none;
      li {
        margin-left: 20px;
        font-size: 20px;
        cursor: pointer;
        width: 120px;
      }
      .active {
        border-bottom: 4px solid #5d90be;
        color: #5d90be;
      }
    }
    p {
      position: absolute;
      top: 70px;
      left: 120px;
      color: #d0d0d0;
      font-size: 14px;
      &:hover {
        cursor: pointer;
        color: #5d90be;
      }
    }
  }
  .banner {
    width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    .banner-left {
      background: #fff;
      width: 700px;
      height: auto;
      text-align: left;
      padding-top: 10px;
      padding-left: 20px;
      padding-right: 20px;
      .writeS {
        width: 100%;
        p {
          padding-left: 20px;
          color: #aed6ff;
          font-size: 12px;
        }
        textarea {
          width: 100%;
          height: 78px;
          color: #333;
          max-height: 520px;
          min-height: 78px;
          font-size: 14px;
          line-height: 24px;
        //   resize: none;
          border: 1px solid #e8e8e8;
          outline: none;
        }
        .main-foot {
          display: flex;
          justify-content: flex-end;
          margin-top: 20px;
          padding-bottom: 30px;
          .main-foot-l {
            display: flex;
            justify-content: flex-end;
            list-style: none;
            margin-left: 80px;
            align-items: center;
            margin-right:20px;
            li{
             margin-left: 10px;
             font-size: 14px;
             select{
               border:0;
               option{
                 border:0;
               }
             }
            }
          }
          .main-foot-r {
            width: 80px;
            height: 30px;
            background: #5a90ba;
            color: #fff;
            line-height: 30px;
            font-size: 12px;
            border-radius: 10px;
            cursor: pointer;
            text-align: center;
          }
        }
      }
    }
    .banner-right {
      background: #fff;
      width: 400px;
      height: auto;
      .tab-card1 {
        height: auto;
        display: none;
        margin-bottom: 20px;
        background: #fff;
        .title {
          font-size: 20px;
          padding: 0 20px;
          padding-top: 5px;
          color: #5d90be;
          padding-top: 20px;
          display: flex;
          justify-content: space-between;
          .more {
            font-size: 12px;
            display: inline-block;
            width: 70px;
            height: 30px;
            line-height: 30px;
            cursor: pointer;
          }
          .news {
            color: #9f9f9f;
            border-bottom: 2px solid #5d90be;
          }
        }
        .content {
          margin-top: 10px;
          height: auto;
          div {
            color: #7a7b7c;
            cursor: pointer;
          }
          p {
            text-align: left;
            margin-left: 20px;
            display: flex;
            justify-content: flex-start;
            cursor: pointer;
            img {
              display: inline-block;
              width: 30px;
              height: 30px;
              border-radius: 50%;
            }
            span {
              display: inline-block;
              color: #5d90be;
              font-size: 10px;
              overflow: hidden;
              text-overflow: ellipsis;
              white-space: nowrap;
              line-height: 30px;
              padding-left: 10px;
              padding-right: 30px;
            }
          }
          div {
            // height: 155px;
            margin-top: -10px;
            text-align: left;
            padding: 0 15px;
            font-size: 12px;
            letter-spacing: 2px;
            padding-bottom: 10px;
            span {
              color: #5d90be;
              margin-left: 10px;
              letter-spacing: 1px;
              cursor: pointer;
            }
          }
        }
      }
    }
  }
}
</style>


